<?php

// show off: template
require_once("configuration.php");
require_once("includes/function.php");
$id = (isset($_GET['id'])) ? intval(sql_injection($_GET['id'])) : 0;
// check id is integer
if (is_int($id) && $id > 0) {
    require_once("includes/cart.php");
    $cart = new customers_cart();
    $cart->customer_id = $CurrentSession->customer_id;
    $cart->session_id  = $CurrentSession->session_id;
    $cart->product_id = $id;
    $cart->quantity = 1;
    $cart->status = cart_status::Active;
    $cart->create();
   
    $mysql->c();
    header("location: ".$_SERVER["HTTP_REFERER"]."#{$id}");
    exit();
}
require_once("configuration.end.php");
?>